
							 
							<CFQUERY NAME="GetLookup" DATASOURCE="#client.global_dsn#">
								SELECT A.*, B.LEVELID
								FROM GSTLOOKUP A, GRGBOSETABLE B
								WHERE 
									(A.MASTERTABLE = '#ATTRIBUTES.MASTERTABLE#') AND
									(A.MASTERFIELD = '#ATTRIBUTES.MASTERFIELD#') 
									AND
									(A.LOOKUPTABLE = B.TABLENAME)
							</CFQUERY>
							<CFIF GetLookup.RecordCount>
								<CFIF (#trim(GetLookup.LEVELID)# IS "") OR
									(#trim(GetLookup.LOOKUPKEYFIELD)# IS "") OR
									(#trim(GetLookup.LOOKUPRESULTFIELD)# IS "") OR
									(#trim(GetLookup.LOOKUPTABLE)# IS "")>
									<CFSET CALLER.LOOKUPRESULT = "*Lookup not properly setup.">
								<CFELSE>
								
								
									<CFMODULE TEMPLATE="#client.common_path#cfm_leveldsn.cfm" DBLEVEL="#GetLookup.LEVELID#">
									<CFSET lk_dsn = DSN>
		
									<CFQUERY NAME="GetLkDesc" DATASOURCE="#lk_dsn#">
										SELECT #GetLookup.LOOKUPRESULTFIELD#
										<CFIF Trim(GetLookup.EXTRARESULTFLD) NEQ "">
											,#GetLookup.EXTRARESULTFLD#
										<CFSET lWithExtra=true>
										</CFIF>
										FROM #GetLookup.LOOKUPTABLE#
										WHERE
											(#GetLookup.LOOKUPKEYFIELD# = 
											'#ATTRIBUTES.VALUETOLOOK#')
									</CFQUERY>
									<CFIF GetLkDesc.RECORDCOUNT>
										<CFSET CALLER.LOOKUPRESULT = 
										"- #EVALUATE("GetLkDesc.#GetLookup.LOOKUPRESULTFIELD#")#" >
									<CFELSE>
										
										<CFSET CALLER.LOOKUPRESULT = "">
									</CFIF>
								</CFIF>
							<CFELSE>
								<CFSET CALLER.LOOKUPRESULT = "">
							</CFIF>
								